#include<stdio.h>
 
int main () {
 
	int i;
	long long n;
	
	scanf("%d",&n);
 
	
	long long temp;	
	if(n%2 == 0){	
		temp = (n-1)*(n-2)*(n-3);
		
		int judge = 3;
		while(n%judge == 0){	
			judge ++;	
			judge ++;
		}
		long long k = n*(n-1)*(n-judge);	
		
		if(temp > k){
			printf("%lld",temp);
		} else {
			printf("%lld",k);
		}
	} 
	else {	
		printf("%lld",n*(n-1)*(n-2));
	}
 
	return 0;
}
